from pw_meta_class import PwSpider

class PwTestSpider(PwSpider):

    def __init__(self, pPort=10809, headless=False, Brow="webkit", anony=True):
        super().__init__(pPort, headless, Brow, anony)
    
    def get_html(self,url):
        """
        在这里我们需要使用self.browser和get_device()方法
        """
        device = self.get_device()
        page = self.browser.new_page(
            **device
        )
        page.goto(url)
        #page.wait_for_timeout(5000)
        html = page.content()
        page.close()
        return html

if __name__ == "__main__":
    spider = PwTestSpider()
    url = 'http://www.httpbin.org/get'
    print(spider.get_html(url))
    spider.stop_pw()